<?php

/**
 * dashboard actions.
 *
 * @package    TourAPI
 * @subpackage dashboard
 * @author     enkuso
 * @version    SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class dashboardActions extends sfActions
{
    /**
     * Dashboard
     */
    public function executeIndex()
    {
        $this->menu_items = sfConfig::get('app_menu_items');
        foreach($this->menu_items as $table => $params){
            $this->menu_items[$table]['count'] = Doctrine_Core::getTable($params['model'])
                ->createQuery('t')
                ->select('COUNT(t.id)')
                ->execute(array(),Doctrine::HYDRATE_SINGLE_SCALAR);
        }
    }
    /**
     * Settings
     */
    public function executeSettings()
    {
        $this->pscount = Doctrine_Core::getTable('PhotosetPurpose')
            ->createQuery('t')
            ->select('COUNT(t.id)')
            ->execute(array(),Doctrine::HYDRATE_SINGLE_SCALAR);
        $this->pcount = Doctrine_Core::getTable('PhotoPurpose')
            ->createQuery('t')
            ->select('COUNT(t.id)')
            ->execute(array(),Doctrine::HYDRATE_SINGLE_SCALAR);
        $this->cpcount = Doctrine_Core::getTable('CategoryPhotoPurpose')
            ->createQuery('t')
            ->select('COUNT(t.id)')
            ->execute(array(),Doctrine::HYDRATE_SINGLE_SCALAR);
    }
}
